package com.kfm.servlet;

import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

// 默认 servlet 名字是 类的规范表示(全限定类名)
@WebServlet(name = "helloServlet", urlPatterns = {"/hello", "/h"})
public class HelloServlet implements Servlet {

    public HelloServlet(){
        System.out.println("构造执行");
    }

    @Override
    public void init(ServletConfig servletConfig) throws ServletException {
        System.out.println("初始化 servlet");
    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("接收到请求");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {
        System.out.println("销毁 servlet");
    }
}
